home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-PPC / SIGINFO.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  5KB  |  198 lines

  1. #ifndef _PPC_SIGINFO_H
  2. #define _PPC_SIGINFO_H
  3.  
  4. /* Copied from i386 from alpha. */
  5.  
  6. #include <linux/types.h>
  7.  
  8. typedef union sigval {
  9.     int sival_int;
  10.     void *sival_ptr;
  11. } sigval_t;
  12.  
  13. #define SI_MAX_SIZE    128
  14. #define SI_PAD_SIZE    ((SI_MAX_SIZE/sizeof(int)) - 3)
  15.  
  16. typedef struct siginfo {
  17.     int si_signo;
  18.     int si_errno;
  19.     int si_code;
  20.  
  21.     union {
  22.         int _pad[SI_PAD_SIZE];
  23.  
  24.         /* kill() */
  25.         struct {
  26.             pid_t _pid;        /* sender's pid */
  27.             uid_t _uid;        /* sender's uid */
  28.         } _kill;
  29.  
  30.         /* POSIX.1b timers */
  31.         struct {
  32.             unsigned int _timer1;
  33.             unsigned int _timer2;
  34.         } _timer;
  35.  
  36.         /* POSIX.1b signals */
  37.         struct {
  38.             pid_t _pid;        /* sender's pid */
  39.             uid_t _uid;        /* sender's uid */
  40.             sigval_t _sigval;
  41.         } _rt;
  42.  
  43.         /* SIGCHLD */
  44.         struct {
  45.             pid_t _pid;        /* which child */
  46.             uid_t _uid;        /* sender's uid */
  47.             int _status;        /* exit code */
  48.             clock_t _utime;
  49.             clock_t _stime;
  50.         } _sigchld;
  51.  
  52.         /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  53.         struct {
  54.             void *_addr; /* faulting insn/memory ref. */
  55.         } _sigfault;
  56.  
  57.         /* SIGPOLL */
  58.         struct {
  59.             int _band;    /* POLL_IN, POLL_OUT, POLL_MSG */
  60.             int _fd;
  61.         } _sigpoll;
  62.     } _sifields;
  63. } siginfo_t;
  64.  
  65. /*
  66.  * How these fields are to be accessed.
  67.  */
  68. #define si_pid        _sifields._kill._pid
  69. #define si_uid        _sifields._kill._uid
  70. #define si_status    _sifields._sigchld._status
  71. #define si_utime    _sifields._sigchld._utime
  72. #define si_stime    _sifields._sigchld._stime
  73. #define si_value    _sifields._rt._sigval
  74. #define si_int        _sifields._rt._sigval.sival_int
  75. #define si_ptr        _sifields._rt._sigval.sival_ptr
  76. #define si_addr        _sifields._sigfault._addr
  77. #define si_band        _sifields._sigpoll._band
  78. #define si_fd        _sifields._sigpoll._fd
  79.  
  80. /*
  81.  * si_code values
  82.  * Digital reserves positive values for kernel-generated signals.
  83.  */
  84. #define SI_USER        0    /* sent by kill, sigsend, raise */
  85. #define SI_KERNEL    0x80    /* sent by the kernel from somewhere */
  86. #define SI_QUEUE    -1    /* sent by sigqueue */
  87. #define SI_TIMER    -2    /* sent by timer expiration */
  88. #define SI_MESGQ    -3    /* sent by real time mesq state change */
  89. #define SI_ASYNCIO    -4    /* sent by AIO completion */
  90. #define SI_SIGIO    -5    /* sent by queued SIGIO */
  91.  
  92. #define SI_FROMUSER(siptr)    ((siptr)->si_code <= 0)
  93. #define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
  94.  
  95. /*
  96.  * SIGILL si_codes
  97.  */
  98. #define ILL_ILLOPC    1    /* illegal opcode */
  99. #define ILL_ILLOPN    2    /* illegal operand */
  100. #define ILL_ILLADR    3    /* illegal addressing mode */
  101. #define ILL_ILLTRP    4    /* illegal trap */
  102. #define ILL_PRVOPC    5    /* privileged opcode */
  103. #define ILL_PRVREG    6    /* privileged register */
  104. #define ILL_COPROC    7    /* coprocessor error */
  105. #define ILL_BADSTK    8    /* internal stack error */
  106. #define NSIGILL        8
  107.  
  108. /*
  109.  * SIGFPE si_codes
  110.  */
  111. #define FPE_INTDIV    1    /* integer divide by zero */
  112. #define FPE_INTOVF    2    /* integer overflow */
  113. #define FPE_FLTDIV    3    /* floating point divide by zero */
  114. #define FPE_FLTOVF    4    /* floating point overflow */
  115. #define FPE_FLTUND    5    /* floating point underflow */
  116. #define FPE_FLTRES    6    /* floating point inexact result */
  117. #define FPE_FLTINV    7    /* floating point invalid operation */
  118. #define FPE_FLTSUB    8    /* subscript out of range */
  119. #define NSIGFPE        8
  120.  
  121. /*
  122.  * SIGSEGV si_codes
  123.  */
  124. #define SEGV_MAPERR    1    /* address not mapped to object */
  125. #define SRGV_ACCERR    2    /* invalid permissions for mapped object */
  126. #define NSIGSEGV    2
  127.  
  128. /*
  129.  * SIGBUS si_codes
  130.  */
  131. #define BUS_ADRALN    1    /* invalid address alignment */
  132. #define BUS_ADRERR    2    /* non-existant physical address */
  133. #define BUS_OBJERR    3    /* object specific hardware error */
  134. #define NSIGBUS        3
  135.  
  136. /*
  137.  * SIGTRAP si_codes
  138.  */
  139. #define TRAP_BRKPT    1    /* process breakpoint */
  140. #define TRAP_TRACE    2    /* process trace trap */
  141. #define NSIGTRAP
  142.  
  143. /*
  144.  * SIGCHLD si_codes
  145.  */
  146. #define CLD_EXITED    1    /* child has exited */
  147. #define CLD_KILLED    2    /* child was killed */
  148. #define CLD_DUMPED    3    /* child terminated abnormally */
  149. #define CLD_TRAPPED    4    /* traced child has trapped */
  150. #define CLD_STOPPED    5    /* child has stopped */
  151. #define CLD_CONTINUED    6    /* stopped child has continued */
  152. #define NSIGCHLD
  153.  
  154. /*
  155.  * SIGPOLL si_codes
  156.  */
  157. #define POLL_IN        1    /* data input available */
  158. #define POLL_OUT    2    /* output buffers available */
  159. #define POLL_MSG    3    /* input message available */
  160. #define POLL_ERR    4    /* i/o error */
  161. #define POLL_PRI    5    /* high priority input available */
  162. #define POLL_HUP    6    /* device disconnected */
  163. #define NSIGPOLL    6
  164.  
  165. /*
  166.  * sigevent definitions
  167.  * 
  168.  * It seems likely that SIGEV_THREAD will have to be handled from 
  169.  * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
  170.  * thread manager then catches and does the appropriate nonsense.
  171.  * However, everything is written out here so as to not get lost.
  172.  */
  173. #define SIGEV_SIGNAL    0    /* notify via signal */
  174. #define SIGEV_NONE    1    /* other notification: meaningless */
  175. #define SIGEV_THREAD    2    /* deliver via thread creation */
  176.  
  177. #define SIGEV_MAX_SIZE    64
  178. #define SIGEV_PAD_SIZE    ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  179.  
  180. typedef struct sigevent {
  181.     sigval_t sigev_value;
  182.     int sigev_signo;
  183.     int sigev_notify;
  184.     union {
  185.         int _pad[SIGEV_PAD_SIZE];
  186.  
  187.         struct {
  188.             void (*_function)(sigval_t);
  189.             void *_attribute;    /* really pthread_attr_t */
  190.         } _sigev_thread;
  191.     } _sigev_un;
  192. } sigevent_t;
  193.  
  194. #define sigev_notify_function    _sigev_un._sigev_thread._function
  195. #define sigev_notify_attributes    _sigev_un._sigev_thread._attribute
  196.  
  197. #endif
  198.